#include "ftp_user.h"
#include "auth_exception.h"

#include "ftp_group.h"

AUTH_NS_START

FtpUser::FtpUser(std::string userName, uid_t sid)
	: m_sUserName(userName), m_sSid(sid), m_GroupList() {
}

FtpUser::~FtpUser() {
}

void FtpUser::RegisterGroupToUser(const FtpGroup* group) {
	gid_t gid = group->GetGid();
	this->m_GroupList[gid] = group->GetGroupName();	
}

bool FtpUser::IsUserMemberOfGroup(const FtpGroup* group) const
{
	GroupListType::const_iterator pos = m_GroupList.find(group->GetGid());

	bool found = (pos != m_GroupList.end());
	return found;
}

AUTH_NS_END
